Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn on and off HSI clock if system clock use MSI clock. #131

Merged
merged 3 commits into from
Feb 19, 2019

Conversation

chwon64
Copy link
Collaborator

@chwon64 chwon64 commented Feb 18, 2019

This is for #125

@chwon64 chwon64 self-assigned this Feb 18, 2019
@chwon64 chwon64 added the bug label Feb 18, 2019
@terrillmoore terrillmoore changed the title Turn on nad off HSI clock if system clock use MSI clock. Turn on and off HSI clock if system clock use MSI clock. Feb 18, 2019
if ((uTime - s_uLastCalibTime) < 2000)
return true;

s_uLastCalibTime = uTime;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK for now, but long term we should not use statics in C++ code. This belongs in the parent object (which is either the Catena or "cAdc" class that's embedded. AdcCalibrate should be a private method of the enclosing object, possibly with a friend class (for the individual sense points, if we decide to have a ADC measurement class so that we write gCatena.Vbus.Read() instead of the current replication of names).

Copy link
Member

@terrillmoore terrillmoore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with merging. Please check my comments, and do what makes sense.

@@ -238,16 +274,30 @@ static bool AdcCalibrate(void)
// return false;
}

uTime = millis();
if ((uTime - s_uLastCalibTime) < 2000)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2000 should be a constexpr defined at the top of the module.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I will add ADC_CALIBRATE_TIME.

" CR=%x ISR=%x\n",
ADC1->CR,
ADC1->ISR
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These printfs() add a lot of code to the image. We're getting close to needing a macro or something for this. We don't have a lot of flash space. But OK for now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added for debugging purpose. I think we don't need right now. I will comment out all debug message.

@terrillmoore terrillmoore merged commit f4c5107 into master Feb 19, 2019
@terrillmoore terrillmoore deleted the issue125 branch February 19, 2019 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants